<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns a correctly ordered and delimited locale ID</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="locale.canonicalize.html">Locale::canonicalize</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="locale.filtermatches.html">Locale::filterMatches</a></div>
 <div class="up"><a href="class.locale.html">Locale</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="locale.composelocale" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Locale::composeLocale</h1>
  <h1 class="refname">locale_compose</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PECL intl &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Locale::composeLocale</span> -- <span class="refname">locale_compose</span> &mdash; <span class="dc-title">Returns a correctly ordered and delimited locale ID</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-locale.composelocale-description">
  <h3 class="title">说明</h3>
  <p class="para">
   面向对象风格
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">string</span> 
   <span class="methodname"><strong>Locale::composeLocale</strong></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$subtags</code></span>
   )</div>

  <p class="para rdfs-comment">
   过程化风格
  </p>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> 
   <span class="methodname"><strong>locale_compose</strong></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$subtags</code></span>
   )</div>

  <p class="para rdfs-comment">
   Returns a correctly ordered and delimited locale ID the keys identify the
   particular locale ID subtags, and the values are the associated subtag
   values.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-locale.composelocale-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">subtags</code></em></dt>

     <dd>

      <p class="para">
       an array containing a list of key-value pairs, where the keys identify
       the particular locale ID subtags, and the values are the associated
       subtag values. 
       <blockquote class="note"><p><strong class="note">Note</strong>: 
        <p class="para">
         The &#039;variant&#039; and &#039;private&#039; subtags can take maximum 15 values
         whereas &#039;extlang&#039; can take maximum 3 values.e.g. Variants are allowed
         with the suffix ranging from 0-14. Hence the keys for the input array
         can be variant0, variant1, ...,variant14. In the returned locale id,
         the subtag is ordered by suffix resulting in variant0 followed by
         variant1 followed by variant2 and so on.
        </p>
        <p class="para">
         The &#039;variant&#039;, &#039;private&#039; and &#039;extlang&#039; multiple values can be specified both
         as array under specific key (e.g. &#039;variant&#039;) and as multiple numbered keys
         (e.g. &#039;variant0&#039;, &#039;variant1&#039;, etc.).
        </p>
       </p></blockquote>
      </p>
     </dd>

    
   </dl>

  </p>
 </div>



 <div class="refsect1 returnvalues" id="refsect1-locale.composelocale-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The corresponding locale identifier.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-locale.composelocale-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-2470">
   <p><strong>Example #1 <span class="function"><strong>locale_compose()</strong></span> example</strong></p>
   <div class="example-contents">
    <div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$arr&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'language'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'en'&nbsp;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'script'&nbsp;&nbsp;</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'Hans'&nbsp;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'region'&nbsp;&nbsp;</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'CN'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'variant2'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'rozaj'&nbsp;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'variant1'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'nedis'&nbsp;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'private1'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'prv1'&nbsp;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'private2'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'prv2'<br /></span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">locale_compose</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$arr&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
  <div class="example" id="example-2471">
   <p><strong>Example #2 OO example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$arr&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'language'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'en'&nbsp;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'script'&nbsp;&nbsp;</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'Hans'&nbsp;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'region'&nbsp;&nbsp;</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'CN'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'variant2'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'rozaj'&nbsp;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'variant1'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'nedis'&nbsp;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'private1'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'prv1'&nbsp;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'private2'</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">'prv2'<br /></span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">Locale</span><span style="color: #007700">::</span><span style="color: #0000BB">composeLocale</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$arr&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
  <p class="para">以上例程会输出：</p>
  <div class="example-contents screen">
<div class="cdata"><pre>
Locale: en_Hans_CN_nedis_rozaj_x_prv1_prv2
</pre></div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-locale.composelocale-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="locale.parselocale.html" class="function" rel="rdfs-seeAlso">locale_parse()</a> - Returns a key-value array of locale ID subtag elements.</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="locale.canonicalize.html">Locale::canonicalize</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="locale.filtermatches.html">Locale::filterMatches</a></div>
 <div class="up"><a href="class.locale.html">Locale</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
